package com.necsv;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Toast;

public class TheadActivity extends Activity {
    private ProgressDialog dialog;
	private Handler h;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
    }
    
    
    public void btn_onClick(View v)
    {
		Toast.makeText(this, "abc", Toast.LENGTH_LONG).show();
		dialog = ProgressDialog.show(this, "Loading", "Please wait....");
		h = new Handler() {

			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				dialog.dismiss();
				// thanh sonr
				
			}
    		
    	};
    	new Thread()
    	{

			@Override
			public void run() {
				// TODO Auto-generated method stub
				super.run();

				try {
					Thread.sleep(3000);
					h.sendEmptyMessage(0);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

		}.start();
    }
}